import { ReactElement } from "react";
import Login from "@/views/login/index";
import Layout from "@/views/layout";
import Home from "@/views/home/index";
import NotFound from "@/NotFound";
import {
  AppstoreOutlined,
  MailOutlined,
  SettingOutlined,
} from "@ant-design/icons";
import { Outlet } from "react-router-dom";
import BaseForm from "@/views/Form/baseForm";
import SetForm from "@/views/Form/setpForm";
import CardNote from "@/views/Card-Note";
export type RoutesType = {
  path: string;
  title?: string;
  icon?: ReactElement;
  element: ReactElement;
  children?: RoutesType[];
};
const routers: RoutesType[] = [
  {
    path: "/login",
    element: <Login />,
  },
  {
    path: "/",
    element: <Layout />,
    children: [
      {
        title: "首页",
        path: "/home",
        element: <Home />,
        icon: <MailOutlined />,
      },
      {
        title: "UI",
        path: "/app/ui",
        element: <Outlet />,
        icon: <MailOutlined />,
        children: [
          { path: "/app/ui/buttons", title: "按钮", element: <BaseForm /> },
        ],
      },
      {
        title: "笔记工具",
        path: "/app/note",
        element: <Outlet />,
        icon: <MailOutlined />,
        children: [
          { path: "/app/note/home", title: "首页", element: <CardNote /> },
        ],
      },
      {
        path: "/app/animation",
        title: "动画",
        element: <Home />,
        icon: <MailOutlined />,
      },
      {
        path: "/app/form",
        title: "表单",
        element: <Outlet />,
        icon: <MailOutlined />,
        children: [
          {
            path: "/app/form/baseForm",
            title: "基础表单",
            element: <BaseForm />,
          },
          {
            path: "/app/form/step-form",
            title: "分步表单",
            element: <SetForm />,
          },
        ],
      },
      {
        path: "/app/table",
        title: "表格",
        element: <Outlet />,
        icon: <MailOutlined />,
      },
      {
        path: "/app/chart",
        title: "图表",
        element: <Home />,
        icon: <MailOutlined />,
      },
    ],
  },

  // 配置404，需要放在最后
  {
    path: "/*",
    element: <NotFound />,
  },
];
export default routers;
